﻿@model Snippet
<article class="snippetDetails" id="@Model.SnippetId">
    <header>
        @if (Model.CanEdit(User as User)) {
        <a href="@Url.Action("Edit", "Snippets", new { id = this.ViewContext.RouteData.Values["snippetId"], area ="Manage" })" class="lightButton fleft">Edit</a>
        }
        <h1><a href="@Model.Link" rel="Bookmark">@Model.Title</a></h1>
    </header>
    
    <aside class="information">
        <div class="row">
            <span class="left">User</span>
            <span class="right">@Html.DisplayFor(m => m.Author)</span>
        </div>
        <div class="row">
            <span class="left">Created</span>
            <span class="right">@Html.DisplayFor(m => m.DateCreated)</span>
        </div>        
        <div class="row">
            <span class="left">Views</span>
            <span class="right">@Model.Views</span>
        </div>        
        <div class="row">
            <span class="left">Favorited</span>
            <span class="right">@Model.Favorited</span>
        </div>
        <div class="share">
            <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
            <a href="http://twitter.com/share" class="twitter-share-button" data-url="@Request.Url" data-text="@Model.Title" data-count="horizontal" data-via="">Tweet</a>
            
            @if (Request.IsAuthenticated) {
            <a href="@Url.Action("ToggleFavorite", new { id= @Model.SnippetId })" class="favorite @(Model.UserHasFavorited() ? "active": "")">Favorite</a>
            }
        </div>
    </aside>
    
    <section>
        @Html.Raw(Model.Body)
    </section>

</article>
